extends "../calxJS_Hide/calxJS_Hide.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "赤火鸟"                   # 角色的名称
	attCoe.atkRan = 2                 # 攻击距离
	attCoe.maxHp = 6                  # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 7.5                   # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 3                 # 魔法攻击（每点代表13.7）
	attCoe.def = 3.5                    # 物理防御（每点代表15）
	attCoe.mgiDef = 4.5                 # 魔法防御（每点代表16.6）
	atkEff = "atk_dao" 
	xb = "火"
	lv = 3
	addSkillTxt("[红莲业火]挥动业火燃烧目标亚比，造成120%火系物理伤害，40%概率<灼烧>3秒[CD:8]")
	addSkillTxt("[聒噪]赤焰鸣叫，削弱目标物防20%，持续6秒，若目标身上有<灼烧>，则提升自身物防和攻速各10%,最高60%[CD:10]")
	addSkillTxt("[凤凰涅槃]阵亡时燃烧自身凤凰涅槃，清除自身所有增益和减益并恢复所有生命值，双抗3秒内变成0\n之后<混乱><灼烧>全场亚比5秒，第一次阵亡100%涅槃，之后每次阵亡都只有20%概率涅槃")
	addCdSkill("yehuo",8)
	addCdSkill("guozao",10)

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "yehuo":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("红莲业火", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		typeHurtCha(aiCha,att.atk*1.2,Chara.HurtType.PHY,Chara.AtkType.SKILL)
		if sys.rndPer(40):
			aiCha.addBuff(bf.zhuoshao.new(3))
	if id == "guozao":
		var bf = hasBuff("zhuoshao")
		var bf2 = hasBuff("wugong1")
		var bf3 = hasBuff("gongsu1")
		aiCha.addBuff(guozao.new())
		if aiCha.bf !=null:
			if bf2 == null:
				addBuff(wugong1.new())
			elif bf2.att.atkL < 0.6:
				bf2.att.atkL += 0.1
			if bf3 == null:
				addBuff(gongsu1.new())
			elif bf2.att.spd < 0.6:
				bf2.att.spd += 0.1

var np = 1
func _onDeath(atkInfo):
	._onDeath(atkInfo)
	if np == 1:
		if sys.rndPer(100):
			isDeath = false
			plusHp(att.maxHp*1)
			var chas = getAllChas(0)
			for i in chas:
				addBuff(bf.hunluan.new(5))
				addBuff(bf.zhuoshao.new(5))
			for i in buffs:
				if i.isNegetive:
					i.isDel = true
			for i in buffs:
				if i.isNegetive == false:
					i.isDel = true
			addBuff(niepan.new(3))
			np -= 1
	elif np == 0:
		if sys.rndPer(20):
			isDeath = false
			plusHp(att.maxHp * 1)
			for i in buffs:
				if i.isNegetive:
					i.isDel = true
			for i in buffs:
				if i.isNegetive == false:
					i.isDel = true
			addBuff(np.new(3))
			yield(reTimer(3),"timeout")
			var chas = getAllChas(0)
			for i in chas:
				addBuff(bf.hunluan.new(5))
				addBuff(bf.zhuoshao.new(5))

func _onBattleStart():
	._onBattleStart()
	np = 1


class guozao:
	extends Buff
	func _init():
		attInit()
		var dispelable = false
		id = "guozao"	
		isNegetive=true
		att.defL -= 0.20

class niepan:
	extends Buff
	func _init(lv = 1):
		attInit()
		var dispelable = true
		id = "niepan"	
		life = lv
		att.defL -= 1
		att.mgiDef -= 1

class wugong1:
	extends Buff
	func _init():
		attInit()
		var dispelable = false
		id = "wugong1"	
		att.atkL = 0.1

class gongsu1:
	extends Buff
	func _init():
		attInit()
		var dispelable = false
		id = "gongsu1"	
		att.spd = 0.1